package com.pig4cloud.pig.environment.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.pig.environment.entity.SubstationEntity;
import com.pig4cloud.pig.environment.mapper.SubstationMapper;
import com.pig4cloud.pig.environment.service.SubstationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 子站管理
 *
 * @author pig
 * @date 2023-12-18 00:02:27
 */
@Service
public class SubstationServiceImpl extends ServiceImpl<SubstationMapper, SubstationEntity> implements SubstationService {

	@Autowired
	private  SubstationMapper substationMapper;
	@Override
	public Map<Long,String> getNamesByIds(List<Long> ids) {
		QueryWrapper<SubstationEntity> queryWrapper=new QueryWrapper<>();
		queryWrapper.select("id","name").in("id",ids);
		return ids.size()>0?substationMapper.selectList(queryWrapper).stream().collect(Collectors.toMap(SubstationEntity::getId,SubstationEntity::getName)):null;
	}



}